package com.SouthernWall_404.Age_Capitalism;


import com.SouthernWall_404.Age_Capitalism.common.Init.*;
import com.SouthernWall_404.Age_Capitalism.common.Network.ModChannels;
import com.SouthernWall_404.Age_Capitalism.common.Server.commands.OpenMerchantCommand;

import com.SouthernWall_404.Age_Capitalism.common.event.OnClick;
import com.SouthernWall_404.Age_Capitalism.common.event.OnItemChanged;
import com.mojang.logging.LogUtils;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.slf4j.Logger;

// The value here should match an entry in the META-INF/mods.toml file
@Mod(AgeCapitalism.MODID)
public class AgeCapitalism
{
    // Define mod id in a Common place for everything to reference
    public static final String MODID = "age_capitalism";
    // Directly reference a slf4j logger
    private static final Logger LOGGER = LogUtils.getLogger();



    public AgeCapitalism()
    {
        IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();


        modEventBus.addListener(this::registerChannel);



        ModItems.ITEMS.register(modEventBus);
        ModCreativeModeTab.CREATIVE_TABS.register(modEventBus);

        ModBlockEntities.BLOCK_ENTITY_TYPE.register(modEventBus);

        ModBlocks.BLOCKS.register(modEventBus);


//        MinecraftForge.EVENT_BUS.register(ModCommand.class);

        MinecraftForge.EVENT_BUS.addListener(this::commandRegister);
        MinecraftForge.EVENT_BUS.register(OnItemChanged.class);
        MinecraftForge.EVENT_BUS.register(OnClick.class);

        ModMenuType.MENU_TYPE.register(modEventBus); // 注册菜单类型


    }

    private void registerChannel(FMLCommonSetupEvent event)
    {
        ModChannels.register();
    }

    private void commandRegister(RegisterCommandsEvent event)
    {
        OpenMerchantCommand.register(event.getDispatcher());
    }



}
